<template>
  <div class="set">
    <div class="cntTop">
      <span>设置中心</span>
      <i> | </i>
      <span class="url">&nbsp; LOGIN INFORMATION</span>
    </div>
    <div class="card">
      <div class="phone">
        <ul class="clearfix">
          <li>
            <i class="iconfont iconlogin_icon_phone" />
          </li>
          <li class="present">
            <span>当前手机183****8963</span>
            <p>当前手机号可以用于登录网站帐号，重置密码或其他安全验证</p>
          </li>
          <li class="alterPhone">
            <el-button type="primary" plain @click="$refs.cellPhone.showCellPhone()">修改手机号</el-button>
          </li>
        </ul>
      </div>
      <div class="phone">
        <ul class="clearfix">
          <li>
            <i class="iconfont iconlogin_icon_password" />
          </li>
          <li class="present">
            <span>帐号密码</span>
            <p>用于保护帐号信息和登录安全 </p>
          </li>
          <li class="alterPhone">
            <el-button type="primary" plain @click="$refs.myPassword.showPassword()">修改密码</el-button>
          </li>
        </ul>
      </div>
    </div>
    <!-- 修改手机号 -->
    <cell-phone ref="cellPhone" />
    <!-- 修改密码 -->
    <my-password ref="myPassword" />
  </div>
</template>

<script>
import cellPhone from './cellphone'
import myPassword from './password'
export default {
  name: 'Set',
  components: {
    cellPhone,
    myPassword
  },
  data() {
    var validatePass = (rule, value, callback) => {
      if (!value) {
        callback(new Error('请输入新密码'))
      } else if (value.toString().length < 8 || value.toString().length > 18) {
        callback(new Error('密码长度为8 - 18个字符'))
      } else {
        callback()
      }
    }
    var validatePass2 = (rule, value, callback) => {
      if (value === '') {
        callback(new Error('请再次输入密码'))
      } else if (value !== this.resetForm.newpwd) {
        callback(new Error('两次输入密码不一致!'))
      } else {
        callback()
      }
    }

    return {
      resetForm: {
        newpwd: '',
        renewpwd: '',
        code: ''
      },
      resetFormRules: {
        newpwd: [
          { required: true, validator: validatePass, trigger: 'blur' }
        ],
        renewpwd: [
          { required: true, validator: validatePass2, trigger: 'blur' }
        ]
      },
      changePassword: false,
      Password: false,
      formLabelWidth: '120px'
    }
  }
}
</script>

<style lang="scss" scoped>
.set{
  >.cntTop {
    height: 60px;
    line-height: 60px;
    padding-left: 30px;
    border-bottom: 1px solid rgba(237, 237, 237, 1);
    > span {
      font-size: 18px;
      line-height: 24px;
    }
    > i {
      width: 7px;
      height: 15px;
    }
    > .url {
      width: 151px;
      height: 19px;
      font-size: 14px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      line-height: 19px;
      color: rgba(153, 153, 153, 1);
      opacity: 1;
    }
  }
  >.card {
    height: 548px;
    width: 100%;
    background-color: #fff;
    padding: 0 30px;
    .el-button{
      background-color: #fff;
      width:115px;
      height:40px;
      border:1px solid rgba(65,122,239,1);
      border-radius:4px;
      color: rgba(65,122,239,1);
    }
    .el-button:hover{
      background-color: rgba(65,122,239,1);
      color: #fff;
    }
    >.phone{
      height: 100px;
      width: 100%;
      line-height: 100px;
      border-bottom: 1px dashed #ccc;
      ul{
        >li{
          float: left;
          height: 100%;
          line-height: 100px;
          i{
            width:22px;
            height:28px;
            color:rgba(65,122,239,1);
            margin-right: 30px;
          }

        }
        >.present{
          line-height: 35px;
          margin-top: 20px;
          span{
            width:158px;
            height:21px;
            font-size:16px;
            font-weight:bold;
            line-height:21px;
            color:rgba(51,51,51,1);
          }
          P{
            width:432px;
            height:21px;
            font-size:16px;
            line-height:21px;
            color:rgba(153,153,153,1);
          }
        }
        >.alterPhone{
          float: right;
          >.el-button{
            width:115px;
            height:40px;
            border:1px solid rgba(65,122,239,1);
            border-radius:4px;
          }
        }
      }
    }
  }
}

</style>
